<?php defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * @package     Pages Module
 * @author      Matrix Infoline (infolinematrix@gmail.com
 * @copyright   (c) Matrix Infoline
 */

class Index extends Frontend_Controller
{

	public function __construct()
	{
		parent::__construct();
		$this->template->set_layout('default');

		if($this->config->item('development') == true){
			$this->load->spark('codeigniter-forensics');
			$this->output->enable_profiler(true);
		}
		
		$this->load->model(array());
		$this->load->driver(array('session'));
		
		//--PARTIALS--//
		$this->template->set_partial('header', 'header/header');
		$this->template->set_partial('footer', 'footer/footer');
		
		
		$this->load->model('gallery_model');
		
		
	}

	public function index()
	{
		//--WIDGET--//
		$data['adsense'] = setting('adsense_pub_id');
		$data['widget_recent_listing'] = TRUE;
		$data['widget_popular_listing'] = TRUE;
		
		write_session('tmpLOC',null);
		write_session('tmpCAT',null);
		
		$data['category'] = $this->category_model->getCetegory(0,12,TRUE); 
		$data['state'] =  $this->location_model->getLocation(0,99); 
		
		$data['location'] =  config_item('country');
		

		$data['banner'] = $this->gallery_model->getBanner(1,5);
		
		//var_dump($data['banner']);die();
		//print_r($this->template);die();

		
		//print_r($data['category']);die();
		$data['city'] =  $this->location_model->find($deep = 1,$limit = count($data['state']), FALSE);
		$this->template->title(setting('web_title'),setting('web_friendly_name'));
		$this->template->set_metadata('keywords', setting('meta_keyword'));
		$this->template->set_metadata('description', setting('meta_description'));
		$this->template->build('home', $data);
		 
	}

}
